"use strict";
const LOOP_NUMBER = 40000;
const TIMES_KILO_MILLISECONDS = 1000;
const BENCHMARK_COUNT = 120;
const NUM_1 = 1;
const NUM_2 = 2;
const NUM_3 = 3;
const NUM_4 = 4;
const NUM_5 = 5;
const NUM_6 = 6;
const NUM_7 = 7;
function deBugLog(str) {
    console.log(str);
}
function run() {
    console.log('Hello world!');
    const m = LOOP_NUMBER;
    let j = 0;
    let strItems = new Array();
    function addStrElement() {
        while (j < m) {
            strItems.push('digit${j}');
            j = j + 1;
        }
    }
    addStrElement();
    const n = LOOP_NUMBER;
    let i = 0;
    let items = new Array();
    function addElement() {
        while (i < n) {
            items.push(i);
            i += 1;
        }
    }
    addElement();
    function firstWhere(list, fn) {
        for (const x of list) {
            if (fn(x)) {
                return x;
            }
        }
        return 0;
    }
    const nums = [NUM_1, NUM_2, NUM_3, NUM_4, NUM_5, NUM_6, NUM_7];
    function isEven(x) {
        return (x & 1) === 0;
    }
    const firstEven = firstWhere(nums, isEven);
}
class Benchmark {
    /*
     * @Benchmark
     */
    runIteration() {
        const before = Date.now();
        for (let i = 0; i < BENCHMARK_COUNT; i++) {
            run();
        }
        const after = Date.now();
        console.log('LuaJSFight: ms = ' + (after - before));
    }
}
let benchmark = new Benchmark();
benchmark.runIteration();
